﻿//显示保存按钮
function showSaveButton() {
    //插入一个固定的按钮
    var div = $("<div class='adsavewenzhang d_z adfs14' style='right: 84px'>保存</div>");
    //增加到最后，到时需要被替换掉
    $("body").append(div);
    $(div).show();
    bindElementClickEvent(div,adsavewenzhang);

    div = $("<div class='adfenxiang d_z adfs14' >分享</div>");
    //增加到最后，到时需要被替换掉
    $("body").append(div);
    div.show();
    bindElementClickEvent(div,adfenxiang);
}

function adsavewenzhangend()
{
    $(".adsavewenzhang").html("保存");
}

//保存文章信息
function adsavewenzhang(event) {
    var htm =  $(".adsavewenzhang").html();
    if(htm != "保存") return;

    $(".adsavewenzhang").html("保存中");
    var html = $("body").html();

    $.post("/savebody",        {
            content: html,
            u: g_code
        },
        function (ret) {
            //location.href = "/s?u=" + g_code;
            $(".adsavewenzhang").html("保存完毕");
            setTimeout('adsavewenzhangend()',1000);
        }
    );
}

function adfenxiang(event) {
    adsavewenzhang(event);
    _system._guide(true);
}